﻿using System.Data.Services;
using System.Data.Services.Common;
using log4net;

using TheKitchen.Querying.Core.DataAccess;

namespace TheKitchen.Querying
{
    /// <summary>
    /// Exposes our Entity Framework data model as a REST-based service.
    /// </summary>
    public class QueryService : DataService<QueryContext>
    {
        public static ILog logger = LogManager.GetLogger(typeof (QueryService));
        /// <summary>
        /// Initializes the service.
        /// </summary>
        /// <param name="config">The config.</param>
        public static void InitializeService(DataServiceConfiguration config)
        {
           
            config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
            logger.InfoFormat("Query service being initialized");
        }
    } 
}
